package com.qf.controller;

import com.github.pagehelper.PageHelper;
import com.qf.entity.User;
import com.qf.service.UserService;
import com.qf.util.R;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
//使用分页助手分页

@RestController
public class Demo4Controller {
    @Autowired
    private UserService userService;
    private Logger logger = LogManager.getLogger(Demo4Controller.class);
    @GetMapping("/user/list/page")
    public R userList(int pageSize,int pageNum){
        PageHelper.startPage(pageNum,pageSize);
        List<User> list=userService.findAll();
        return R.success(list);
    }
    @GetMapping("/log")
    public R log(){
        logger.debug("这是debug");
        logger.info("这是info");
        logger.warn("这是warn");
        logger.error("这是error");
        return R.success();
    }
}
